---
title: "readLine"
keywords: ""
layout: "default"
root: "/v5.1"
description: "Swift documentation for 'readLine'"
---

<div class="intro-declaration"><code class="language-swift">func readLine(strippingNewline:)(strippingNewline: Bool = true) -> String?</code></div><div class="discussion comment"><p>Returns a string read from standard input through the end of the current
line or until EOF is reached.
</p>
<p>Standard input is interpreted as <code>UTF-8</code>. Invalid bytes are replaced by
Unicode <a href="https://unicode.org/glossary/#replacement_character">replacement characters</a>.</p>
<ul>
<li>Parameter strippingNewline: If <code>true</code>, newline characters and character
combinations are stripped from the result; otherwise, newline characters
or character combinations are preserved. The default is <code>true</code>.</li>
</ul>
</div>